import { Injectable } from '@angular/core';
import { HttpClient } from '../../../providers/httpClient';
import { Config } from '../../../providers/config';

@Injectable()
export class AuthorizationDetailService {
	constructor(
		public httpClient: HttpClient,
		public config: Config,
	) { }
	/**
	 * [updateAuthorization 更新授权]
	 * @param {[type]} params [description]
	 */
	updateAuthorization(params) {
		let postBody = {
			"module": "WorkFlow",
			"method": "updateAuthorization",
			"params": {
				"loginId": "",
				"authorizationDto": {
					"authorized": params.authorized,
					"authorizedName": params.authorizedName,
					"edate": params.edate,
					"empid": params.empid,
					"empidName": params.empidName,
					"module": params.module,
					"moduleName": params.moduleName,
					//"newStat": params.newStat,
					"numb": params.numb,
					"sdate": params.sdate,
					"stat": params.stat,
					"type": params.type,
					//"updateTime": params.updateTime
				}
			}
		};
		return this.httpClient.post(postBody, {
			isShowLoading: true
		});
	}

	/**
	 * [insertAuthorization 新增授权]
	 * @param {[type]} params [description]
	 */
	insertAuthorization(params) {
		let postBody = {
			"module": "WorkFlow",
			"method": "insertAuthorization",
			"params": {
				"loginId": "",
				"authorizationDto": {
					"authorized": params.authorized,
					"authorizedName": params.authorizedName,
					"edate": params.edate,
					"empid": params.empid,
					"empidName": params.empidName,
					"module": params.module,
					"moduleName": params.moduleName,
					//"newStat": params.newStat,
					"numb": params.numb,
					"sdate": params.sdate,
					"stat": params.stat,
					"type": params.type,
					//"updateTime": params.updateTime
				}
			}
		};
		return this.httpClient.post(postBody, {
			isShowLoading: true
		});
	}

	/**
	 * [deleteAuthorization 删除授权]
	 * @param {[type]} numb [description]
	 */
	deleteAuthorization(numb) {
		let postBody = {
			"module": "WorkFlow",
			"method": "deleteAuthorization",
			"params": {
				"loginId": "",
				"numb": numb
			}
		};
		return this.httpClient.post(postBody, {
			isShowLoading: true
		});
	}

	/**
	 * [getDirDir 系统目录树]
	 */
	getDirDir() {
		let postBody = {
			"module": "CommonTools",
			"method": "getDirDir",
			"params": {
				"rootDir": "CM"
			}
		}

		return this.httpClient.post(postBody, {
			isShowLoading: true
		});
	}
}
